<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新闻详情</title>
    <link rel="stylesheet" href="/static/index/css/detail.css">
    <style>
        *{
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        ul li{
            list-style: none;
        }
        .container-all
        {
            width: 1150px;
            margin: 0 auto;
            font-size: 16px;
        }
        .container-all .body{
            width:100%;
        }
        .body .body-left{
            width: 850px;
            float: left;
        }
        .body-left::after{
            clear: both;
        }
        .body-left .l-header{
            width: 100%;
            height: 60px;
            padding-top: 15px;
            box-sizing: border-box;
        }
        .l-header .l-header-img{
            width: 130px;
            float: left;
            padding: 2px 0px;
            box-sizing: border-box;
        }
        .l-header .nav li{
            float: left;
            height: 100%;
            padding: 5px 8px;
            box-sizing: border-box;
        }
        .l-content{
            width: 100%;
        }
        .l-content .l-con-head{
            width: 100%;
            height: 151px;
            padding: 10px 0px;
            box-sizing: border-box;
            border-bottom: 1px solid #eee
        }
        .l-content .l-con-body{
            padding-top: 20px;
            box-sizing: border-box;
        }
        .l-con-head .l-con-title{
            width: 100%;
            font-size: 25px;
            font-weight: bolder;
            padding-top: 20px;
            box-sizing: border-box;
            height: 80px;
        }
        .l-con-head  .l-con-author{
            height: 50px;
            line-height: 50px;
        }

        .body .body-right{
            width: 300px;
            float: left;
        }
        .body-right .r-search{
            width: 100%;
            height: 60px;
            padding-top: 15px;
            box-sizing: border-box;
        }
        .r-search .r-search-input{
            float: left;
            width: 235px;
            border-right: 0;
            border-radius: 2px 0 0 2px;
            display: block;
            height: 34px;
            padding: 6px 12px;
            box-sizing: border-box;
            font-size: 14px;
            line-height: 1.42857143;
            color: #555;
            background-color: #fff;
            background-image: none;
            border: 1px solid #ccc;
            -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
            box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
            -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
            -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
            transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
        }
        .r-search .r-search-button{
            float: left;
            height: 34px;
            border-radius: 0 2px 2px 0;
            border-color: #255;
            background-color: #277;
            padding: 5px 10px;
            font-size: 12px;
            line-height: 1.5;
            color: #fff;
            display: inline-block;
            margin-bottom: 0;
            font-weight: normal;
            text-align: center;
            vertical-align: middle;
            touch-action: manipulation;
            cursor: pointer;
            background-image: none;
            border: 1px solid transparent;
            white-space: nowrap;
        }
        .body-right .r-hot{
            width: 100%;
            padding-top: 20px;
            box-sizing: border-box;
        }

        .r-hot h3{
            margin: 8px 0;
            padding: 2px 8px;
            border-left: 5px solid #eee;
            display: block;
            font-size: 1.17em;
            margin-block-start: 1em;
            margin-block-end: 1em;
            margin-inline-start: 0px;
            margin-inline-end: 0px;
            font-weight: bold;
            color: #277;
        }
        .list-ol {
            padding-left: 1.5em;
        }
        .list-ol li {
            padding: 3px 0;
            line-height: 1.8rem;
        }
        .list-ol li  a {
            color: #555;
            text-decoration: none;
        }
        h3  .sub_title{
            display: block;
            color: #AAA;
            text-transform: uppercase;
            font-weight: normal;
            font-size: .8rem;
        }
        .r-hot .comment-textarea{
            width: 100%;
            padding: 5px 5px;
            box-sizing: border-box;
        }
        .comment-body{
            padding-left: 0.5em;
        }
        .comment-body-line{
            display: block;
            line-height: 40px;
            width: 100%;
        }
        .comment-user{
            color: darkgreen;
            float: left;
            font-size: 18px;
        }
        .comment-content{
            text-indent: 8px;
            margin-left: 10px;
            display: block;
            font-size: 14px;
        }
        .comment-textarea textarea{
            width: 100%;
            height: 150px;
            padding: 5px;
            font-size: 16px;
            font-family: "Arial", "Microsoft YaHei", "黑体", "宋体", sans-serif;
        }
        .comment-btn button{
            padding: 8px 10px;
            font-size: 13px;
            background-color: #277;;
            color: white;
            float: right;
            border-radius: 3px;
            border: none;
            margin-top: 5px;
        }

        .footer { font-size: 12px; overflow: hidden; padding: 50px 0; text-align: center; background-color: #F2F6F8; width: 100%; color: #888; }

        .footer .link { margin-bottom: 0.5em; }

        .footer .link a { color: #010101; font-size: 16px; }

        .footer .link a:hover { color: #388d78; }

        @media (max-width: 1499px) { .footer .link a { font-size: 14px; } }

        @media (max-width: 1279px) { .footer .link a { font-size: 12px; } }

        .footer .link em { color: #ccc; margin: 0 8px; }

        .footer .info { font-size: 12px; line-height: 2.5em; padding-top: 12px; }

        .footer .info em { margin: 0 0.5em; }

        .footer .copyright p { margin: 0; }
        .min-height{
            min-height: 800px;
        }
    </style>
</head>
<body>
<div class="container-all">
    <input type="hidden" id="news_id" value="{$newInfo.id}">
    <div class="body">
        <div class="body-left">
            <div class="l-header">
                <div class="l-header-img">
                    <img  src="/static/index/images/brand.png" alt="">
                </div>
                <ul class="nav">
                    {foreach $puTongList as $k =>$v}
                    <li>
                        <a href="{:url('newsCateList')}?id={$v['id']}&cate_name={$v['cate_name']}"  target="_blank"  style="font-size: 14px;color: #191413;text-decoration: none;">{$v['cate_name']}</a><!--end 6850292-0-5-->
                    </li>
                    {/foreach}
                </ul>
            </div>
            <!--这个旅组建“蓝军”分队 对抗演练有了“磨刀石”-->
            <div class="l-content min-height">
                <div class="l-con-head">
                    <div class="l-con-title">{$newInfo.title}</div>
                    <div class="l-con-author">
                        <span class="author">作者：{$newInfo.author} 责任编辑：{$newInfo.editor}</span>
                        <span class="time"> {$newInfo.create_time| date ='Y-m-d H;i:s'}</span>
                    </div>
                </div>
                <div class="l-con-body">
                    {$newInfo.content | raw}
                </div>
            </div>
        </div>
        <div class="body-right">
            <form action="{:url('index/search')}" class="search pull-right hidden-xs" method="POST" target="_blank">
                <div class="r-search">
                    <input type="text" placeholder="请输入新闻标题" class="r-search-input" name="title" >
                    <button type="submit" class="r-search-button">搜索</button>
                </div>
            </form>
            <div class="r-hot">
                <h3>
                    <span class="title">最新文章</span>
                    <span class="sub_title">News Article</span>
                </h3>
                <ol class="list-ol" id="NEW-YAOWENTUIJIAN">
                    {foreach $newsArticle as $k=>$v}
                        <li>
                            <a href="{:url('index/detail')}?id={$v['id']}" target="_blank">{$v['title']}</a>
                        </li>
                    {/foreach}
                </ol>
                <h3>
                    <span class="title">热门评论</span>
                    <span class="sub_title">Hot Reviews</span>
                </h3>
                <div class="comment-body" id="comment-body">
                    {foreach $commmentList as $k  => $v}
                        <div class="comment-body-line">
                            <span class="comment-user"  >{$v['username']}:</span>
                            <p class="comment-content" style="">{$v['comment']}</p>
                        </div>
                    {/foreach}
                </div>
                <div class="comment-textarea">
                    <textarea id="comment-textarea" cols="50" rows="20"></textarea>
                    <div class="comment-btn"><button id="comment-btn">登录/评论</button></div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file='common/footer'/}
</body>
<script type="text/javascript" src="/static/plugins/layui/layui.js"></script>
<script>
    layui.use('form',function(){
        var form = layui.form,$ = layui.jquery;
        //监听提交评论
        $("#comment-btn").click(function (e) {
                loading =layer.load(1, {shade: [0.1,'#fff'] });//0.1透明度的白色背景
                var comment =  $("#comment-textarea").val();
                if(comment == "" || comment == 'undefined')
                {
                    layer.close(loading);
                    layer.msg('请输入评论', {icon: 2, anim: 6, time: 1000});
                    return false;
                }
                var news_id =  $("#news_id").val();
                $.post('{:url("comment")}',{comment:comment,news_id:news_id},function(res){
                    layer.close(loading);
                    if(res.code < 1){
                        layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                            var html = " <div class=\"comment-body-line\">\n" +
                                "                            <span class=\"comment-user\"  >"+ res.data.user_name+":</span>\n" +
                                "                            <p class=\"comment-content\" style=\"\">"+ res.data.comment+"</p>\n" +
                                "                        </div>";
                            $("#comment-body").prepend(html);
                            // window.location.reload();
                        });
                    }else{
                        if(res.code == 2)
                        {
                            layer.msg(res.msg, {icon: 2, anim: 6, time: 1000},function () {
                                window.open(res.data.url);
                            });
                        }
                        else
                        {
                            layer.msg(res.msg, {icon: 2, anim: 6, time: 1000});
                            return false;
                        }

                    }
                });
        })
    });
</script>
</html>